<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration {
    /**
     * 目前用途牛 后期可能上自营
     * @return void
     */
    public function up(): void
    {
        Schema::create('scenic_spot_goods_providers', function (Blueprint $table) {
            $table->id();
            $table->string('scenic_id',32)->comment('景点id');
            $table->string('ticket_id',32)->comment('门票id');
            $table->string('provider',8)->comment('供应商 , 如qunar,meituan,self..等');
            $table->string('provider_ticket_id',32)->comment('供应商门票id');
            $table->unsignedDecimal('sale_price',10,2)->comment('销售价 初步不加价');
            $table->unsignedDecimal('provider_sale_price',10,2)->comment('供应商销售价');
            $table->timestamps();
            $table->index(['provider','scenic_id'],'idx_provider');
            $table->unique(['provider_ticket_id','scenic_id','provider'],'unique_provider_spot_ticket');
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('scenic_spot_goods_providers');
    }
};
